<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>最终版</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 300px;
            height: 300px;
            background-color: aquamarine;
            position: relative;
            background: url('01.jpg') no-repeat;
            margin: 100px auto;
        }
        ul{
            position: absolute;
            top: 250px;
            list-style: none;
        }
        li{
            display: inline-block;
        }
        li img{
            width: 50px;
        }
    </style>
</head>
<body>
    <div id="box">
        <ul>
            <li><img src="1.jpg" alt="" class="imgs"></li>
            <li><img src="2.jpg" alt="" class="imgs"></li>
            <li><img src="3.jpg" alt="" class="imgs"></li>
            <li><img src="4.jpg" alt="" class="imgs"></li>
            <li><img src="5.jpg" alt="" class="imgs"></li>
        </ul>
    </div>
    <script>
        
        function $(id_name){
            return typeof id_name === 'string' ? document.getElementById(id_name) : null;
        }
        console.log($('box'))
        var items = document.getElementsByClassName('imgs')
        for(var i=0;i<items.length;i++){
            var item = items[i];
            item.index = i+1;
            items[i].onmouseover = function(){
                $('box').style.background = `url('0${this.index}.jpg') no-repeat`
            }
        }
    </script>
</body>
</html>